<?php
/*
 * Created on Jan 4, 2008
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
require('./View/Security.php');
require('./View/ShowTable.php');
require('./Controller/AdminCheck.php');
$dir = "LN2_Website/"; //This will break if the name of the folder is changed
$name = "murry_LN2_databaseBackup";
$sqlFile = $dir.$fileName;
echo "</br>" . $fileName;
system('./LN2_dump.sh');
$view = new ShowTable();

$cells = selectFromDatabase(array("Name"), "CellType");
$mods = selectFromDatabase(array("Name"), "Modification");
$researchers = selectFromDatabase(array("Name"), "Researcher");
$tubes = selectFromDatabase(array("CellType.Name AS 'Cell Type Name', Modification.Name AS 'Modification Name', Researcher.Name AS 'Researcher Name', Container.Tank, Container.Tower,Container.Position"), "FrozenTube JOIN Container ON(FrozenTube.ContainerID=Container.id) JOIN CellType ON(CellType.id=FrozenTube.CellTypeID) JOIN Modification ON(FrozenTube.ModifiedByID=Modification.id) JOIN Researcher ON(FrozenTube.FrozenByID=Researcher.id)");

$select .= $view -> displayData($cells);
$select .= "</br> </br>";
$select .= $view -> displayData($mods);
$select .= "</br> </br>";
$select .= $view -> displayData($researchers);
$select .= "</br> </br>";
$select .= $view -> displayData($tubes);
$select .= "</br> </br>";


?>

<a href="<?php echo date('y_m_d')."murry_LN2_databaseBackup.sql"?>">Download Backup</a></br>
<BUTTON type="button" name="Print" onclick="print()">Print Backup</button>

<?php echo $select ?>